import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import HuangContent from '@/components/HuangContent.vue'  // 新增全局组件导入
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import axios from 'axios'
import Huangheader from './components/Huangheader.vue'
import Huangback from '@/components/Huangback.vue'
import Huangfooter from './components/Huangfooter.vue'
import Huangheader_2 from './components/Huangheader_2.vue'
import Huangarea from './components/Huangarea.vue'
import HuangLogoInput from './components/Huang-logo-input.vue'
import Huangclassify from './components/Huangclassify.vue'
//Huanglist1
import Huanglist1 from './components/Huanglist1.vue'
import HuangSumList from './components/Huang-sum-list.vue'
const app = createApp(App)

// 注册 Element Plus 图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 注册全局组件
app.component('Huangheader', Huangheader)
app.component('HuangContent', HuangContent)
app.component('Huangback', Huangback)
app.component('Huangfooter', Huangfooter)
app.component('Huangheader2', Huangheader_2)
app.component('Huangarea', Huangarea)
app.component('HuangLogoInput', HuangLogoInput)
app.component('Huangclassify', Huangclassify)
app.component('Huanglist1', Huanglist1)
app.component('HuangSumList', HuangSumList)
axios.defaults.baseURL = 'http://localhost:3000/'
// 使用 Pinia 和插件
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)

// 使用其他插件
app.use(pinia)
app.use(router)
app.use(ElementPlus)

// 配置 axios
axios.defaults.baseURL = 'http://localhost:3000/'
app.config.globalProperties.$axios = axios

// 挂载应用
app.mount('#app')